package ch17;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.KeyEvent;

public class xyy extends JFrame {
    private JPanel nrmb;
    private JLabel jl;

    public xyy() {
        setTitle("小游戏");
        setLayout(null);
        setBounds(100,100,500,500);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        nrmb = new JPanel();
        nrmb.setLayout(null);
        add(nrmb);
        nrmb.setBounds(0,0,100,100);
        nrmb.setBackground(Color.white);
        JLabel bq = new JLabel("xyy");
        nrmb.add(bq);
        bq.setBounds(10,10,40,40);
    }
    public static class DemoPlane extends JPanel {
        public void paint(Graphics g) {
            Image i = new ImageIcon("D:\\java\\夏宇阳的程序\\xiayy-programming-learing\\src\\ressource\\墙.jpg").getImage();
            g.drawImage(i, 0, 0, 100, 100,null);
        }
    }
    /*public void keyPressed(KeyEvent e){
        int keyCode = e.getKeyCode();
        if (keyCode == 38){
            y--;
        }
        if (keyCode == 40){
            y++;
        }
        if (keyCode == 39){
            x--;
        }
        if (keyCode == 41){
            x++;
        }
    }*/
    public static void main(String[] agrs) {
        DemoPlane x=new DemoPlane();    //创建一个实例化对象
        x.setVisible(true);
    }
}